#include "headers/MessageBox.h"
#include "headers/UnderlinePen.h"
#include "headers/Product.h"
#include <iostream>

using namespace Framework;

/* MessageBox implementation */
void MessageBox::use(std::string& s)
{
    unsigned int len = s.length();
    //print header
    for(int i = 0; i < len+2; i++)
        std::cout << deco_char;
    std::cout << "\n"; 
    // print content
    std::cout << deco_char + s + deco_char + "\n";
    //print footer
    for(int i = 0; i < len+2; i++)
        std::cout << deco_char;
    std::cout << std::endl;
}

std::unique_ptr<Product> MessageBox::clone() const
{
    return std::make_unique<MessageBox>(*this);
}


/* Underline Pen implementation */
void UnderlinePen::use(std::string& s)
{
    unsigned int len = s.length();
    std::cout << "\"" << s << "\"\n";
    for(int i = 0; i < len+2; i++)
        std::cout << underline_char;
    std::cout << std::endl;
}

std::unique_ptr<Product> UnderlinePen::clone() const 
{
    return std::make_unique<UnderlinePen>(*this);
}
